# -*- coding: utf-8 -*-
import maya.cmds as cmds
class Check_isLook_Cam():
	def Check_isLook_Cam(self):
		er_CamAttrs = { "translateX" , "translateY" , "translateZ" , "rotateX" , "rotateY" , "rotateZ" }
		CamScales = ['scaleX' , 'scaleY' , 'scaleZ' ]
		ListCam_list = [i for i in cmds.listCameras (p = 1) if i != "persp"]
		ListCam = ListCam_list[0]
		if cmds.nodeType (ListCam) == "camera" :
			Old_Cam = cmds.listRelatives (ListCam , p = True)[0]
		else :
			Old_Cam = ListCam
		if len (ListCam_list ) == 1 :
			try :
				for er_CamAttr in er_CamAttrs :
					if not cmds.getAttr ( Old_Cam + '.' + er_CamAttr , lock = 1) :
						cmds.setAttr ( Old_Cam + '.' + er_CamAttr , lock = 1 )
				for CamScale in CamScales:
					if cmds.getAttr ( Old_Cam + '.' + CamScale , lock = 1):
						cmds.setAttr ( Old_Cam + '.' + CamScale , lock = 0)
						cmds.setAttr ( Old_Cam + '.' + CamScale , 1 )
						cmds.setAttr ( Old_Cam + '.' + CamScale , lock = 1)
					else:
						cmds.setAttr ( Old_Cam + '.' + CamScale , 1 )
						cmds.setAttr ( Old_Cam + '.' + CamScale , lock = 1)
				return("YES")
			except :
				return ("NO-未知错误-手动检查文件")
		else:
			return ("NO-存在多余相机"+str(ListCam_list))
